import Vue from 'vue'
import Vuex from 'vuex'
// import { getUserInfo, checkSubscribe } from "@/api/base";

Vue.use(Vuex)

// const userId = sessionStorage.getItem("zc-userid");
export default new Vuex.Store({
  state: {
	  LOADING:false,
	  userInfo: {
	    id: null,
	    score: "0"
	  },
  },
  getters:{
	// userInfo: state => {
	//   return state.userInfo;
	// },  
  },
  mutations: {
	// updateSubscribe: (state, payload) => {
	//   state.userInfo.is_subscribe = payload;
	// },
	// updateUserInfo: (state, payload) => {
	//   state.userInfo = payload;
	// },  
	showLoading(state){
		state.LOADING = true    
	},
	hideLoading (state) {
		state.LOADING = false
	}
  },
  actions: {
	  // checkSubscribe: async ({ commit }, payload) => {
	  //   const res = await checkSubscribe(payload);
	  //   commit("updateSubscribe", res);
	  // },
	  // fetchUserInfo: async ({ commit }, payload) => {
	  //   const res = await getUserInfo(payload);
	  //   commit("updateUserInfo", res);
	  // }
  },
})
